<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="{{ asset('admin_style/css/pintuer.css') }}">
<link rel="stylesheet" href="{{ asset('admin_style/css/admin.css') }}">
<script src="{{asset('admin_style/js/jquery.js')}}"></script>
<script src="{{asset('admin_style/js/pintuer.js')}}"></script>
</head>
<body>
<div class="panel admin-panel">
  <div class="panel-head"><strong class="icon-reorder"> 分类管理</strong></div>
  <div class="padding border-bottom">
    <a class="button border-yellow" href="{{ url('goods/goods_cateadd')}}"><span class="icon-plus-square-o"></span> 添加分类</a>
  </div>
  <table class="table table-hover text-center">
    <tr>
      <th>分类名称</th>
      <th width="310">操作</th>
    </tr>
    @foreach($cate as $v)
    <tr>
      <td><span class="icon-plus-square padding-right text-main zhankai" name="{{$v->cate_id}}">{{$v->cate_name}}</span></td>
      <td><div class="button-group"> <a class="button border-main" href="cateedit-1.html"><span class="icon-edit"></span> 编辑</a> <a class="button border-red" href="javascript:void(0)" onclick="return del({{$v->cate_id}})"><span class="icon-trash-o"></span> 删除</a> </div></td>
    </tr>
      @foreach($v->zicate as $vv)
        <tr class="hidden-tr" style="display: none;" name="{{$vv->parent_id}}">
          <td>&nbsp;&nbsp;&nbsp;<span class="icon-minus-square padding-right text-main" >{{$vv->cate_name}}</span></td>
          <td><div class="button-group"> <a class="button border-main" href="cateedit-1.html"><span class="icon-edit"></span> 编辑</a> <a class="button border-red" href="javascript:void(0)" onclick="return del({{$vv->cate_id}})"><span class="icon-trash-o"></span> 删除</a> </div></td>
        </tr>
        @endforeach
    @endforeach
  </table>
</div>
<script type="text/javascript">
function del(id){
	if(confirm("您确定要删除吗?")){	
		location.href = "{{ url('goods/goods_cate_del/')}}/"+id;
	}
}
$(function(){
	$(".zhankai").click(function(){
    var cone = $(this).attr('name');
    $(".hidden-tr").each(function(){
      if($(this).attr('name') == cone){
        $(this).toggle();
      }
    });  
	});
	
});
	
	

</script>

</body>
</html>
